﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
using System.Drawing;
using Website.Logger;
using DAL;
using BOL;
using System.Web.Script.Services;
using System.Web.Services;
using WebLib;
using UtilityExtensions;
using System.Globalization;

using UtilityExtensions;

namespace UILGestion.ObraAdmin.RecepcionDoc
{
    public partial class NotaCreditoOPT1Form : System.Web.UI.Page
    {

        public NotaCreditoOPT1Form()
        {
            bol = new RecepcionDocBL();
            proveedor = new ProveedorBL();
        }

        private RecepcionDocBL bol;
        private static ProveedorBL proveedor;

        [WebMethod(), ScriptMethod()]
        public static string GetProveedor(String prefixText, String contextKey)
        {


            return proveedor.getProveedorComparativoAll(prefixText, 20, contextKey.ToInt());

        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                idObra.Value = (string)Request.QueryString["idObra"];
                menuObraCtrl1.loadMenu(int.Parse(idObra.Value), Request.AppRelativeCurrentExecutionFilePath);
                FormatForm();
            }
        }
        private void showComboBox()
        {
            tipoDocumentoDDL.DataTextField = "descripcion";
            tipoDocumentoDDL.DataValueField="idInternal";
            tipoDocumentoDDL.DataSource=new ListValueBL().GetDocumentoTipoRecepcionDoc();
            tipoDocumentoDDL.DataBind();
        }
        private void FormatForm()
        {
            //--------------------
           
            int idEmpleadoEmisor = int.Parse(System.Web.HttpContext.Current.Session["idEmpleado"].ToString());
            bool acceso = new DAL.FormularioAcceso().VerificarAcceso(DbUtil.Db,
                idEmpleadoEmisor,
                9, //FR
                int.Parse(idObra.Value),
                2); //crear
            //------------------------- 
            // los paneles presentes en el formulario
            showComboBox();
            OrdenCompraPendRecepDocumentoPanel.Visible = true;    
        }
     
      
    }
}